library(dplyr)
library(tidyverse)
library(knitr)
library(plotly)
library(kableExtra)
Introduction
Domain knowledge
Data sources
World bank data
library(WDI)
#get datasets on emissions
datasets = WDIsearch("emissions")
# get Total greenhouse gas emissions (kt of CO2 equivalent)
ghg_emissions_wb = WDI(indicator='EN.ATM.GHGT.KT.CE')
# get all world data
ghg_emissions_wb_world = ghg_emissions_wb %>%
filter(country == "World")
# Show data sample
ghg_emissions_wb_world %>%
top_n(10) %>%
kable() %>%
kable_styling(bootstrap_options = c("striped", "hover"), full_width = F, font_size = 13) %>%
scroll_box(width = "100%", height = "400px")
|
iso2c
|
country
|
EN.ATM.GHGT.KT.CE
|
year
|
|
1W
|
World
|
NA
|
2020
|
|
1W
|
World
|
NA
|
2019
|
|
1W
|
World
|
NA
|
2018
|
|
1W
|
World
|
NA
|
2017
|
|
1W
|
World
|
NA
|
2016
|
|
1W
|
World
|
NA
|
2015
|
|
1W
|
World
|
NA
|
2014
|
|
1W
|
World
|
NA
|
2013
|
|
1W
|
World
|
53526303
|
2012
|
|
1W
|
World
|
52790527
|
2011
|
# plot world GHG emissions
ghg_emissions_wb_world %>%
plot_ly() %>%
add_trace(y = ~EN.ATM.GHGT.KT.CE,
x = ~year,
marker = list(color = "gray"),
type = 'scatter',
# type = "line",
mode = 'lines+markers',
orientation = "v") %>%
layout(title = "World GHG emissions (source: WorldBank)",
yaxis = list(title = "GHG emissions"),
xaxis = list(title = "Years"))
World Resources Institute